package io.aircraft.modules.wms.controller;

import io.aircraft.common.page.PageData;
import io.aircraft.common.utils.Result;
import io.aircraft.modules.wms.dto.VwPurchaseShowDTO;
import io.aircraft.modules.wms.service.VwPurchaseShowService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;


/**
 * 供料展示页
 *
 * @author Cycle gengruyi01@163.com
 * @since 1.0.0 2022-10-31
 */
@RestController
@RequestMapping("wms/vw-purchase-show")
public class VwPurchaseShowController {
    @Autowired
    private VwPurchaseShowService vwPurchaseShowService;

    @GetMapping("page")
    @RequiresPermissions("wms:vw-purchase-show:page")
    public Result<PageData<VwPurchaseShowDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
        PageData<VwPurchaseShowDTO> page = vwPurchaseShowService.page(params);

        return new Result<PageData<VwPurchaseShowDTO>>().ok(page);
    }

    @GetMapping("{id}")
    @RequiresPermissions("wms:vw-purchase-show:info")
    public Result<VwPurchaseShowDTO> get(@PathVariable("id") Long id) {
        VwPurchaseShowDTO data = vwPurchaseShowService.get(id);

        return new Result<VwPurchaseShowDTO>().ok(data);
    }

    @GetMapping("list")
    public Result<List<VwPurchaseShowDTO>> selectViewList() {
        List<VwPurchaseShowDTO> data = vwPurchaseShowService.selectViewList();
        return new Result<List<VwPurchaseShowDTO>>().ok(data);
    }
}